import { apiGet, apiPost, apiPut, apiDelete } from './client'

export interface Teacher {
  id?: number
  teacherNo?: string
  name?: string
  deptId?: number
}

export async function listTeachers(params: { keyword?: string; deptId?: number; offset?: number; limit?: number } = {}) {
  return apiGet<{ total: number; items: Teacher[] }>('/api/grades/teachers', params)
}

export async function getTeacher(id: number) {
  return apiGet<Teacher>(`/api/grades/teachers/${id}`)
}

export async function createTeacher(teacher: Teacher) {
  return apiPost<Teacher>('/api/grades/teachers', teacher)
}

export async function updateTeacher(id: number, teacher: Teacher) {
  return apiPut<Teacher>(`/api/grades/teachers/${id}`, teacher)
}

export async function deleteTeacher(id: number) {
  return apiDelete<string>(`/api/grades/teachers/${id}`)
}